vim.cmd [[packadd packer.nvim]]

local fn = vim.fn

vim.cmd [[
   augroup packer_user_config
     autocmd!
     autocmd BufWritePost plugins.lua source <afile> | PackerSync
   augroup end
 ]]

local status_ok, packer = pcall(require, 'packer')
 if not status_ok then
   return
 end

packer.init {
   display = {
     open_fn = function()
       return require('packer.util').float { border = 'rounded' }
     end,
   },
   git = {
     -- default_url_format = 'https://ay1.us/https://github.com/%s' -- 更换git clone链接
   },
 }

return require('packer').startup(function(use)

  use 'wbthomason/packer.nvim'
  use 'kyazdani42/nvim-web-devicons'
  use 'tell-k/vim-autopep8'
  use 'honza/vim-snippets'
  use 'thinca/vim-quickrun'
  use 'Shougo/deoplete.nvim'
  use 'dstein64/vim-menu'
  use 'voldikss/vim-floaterm'
  use 'roxma/nvim-yarp'
  use 'roxma/vim-hug-neovim-rpc'
  use 'w0rp/ale'
  use 'stevearc/dressing.nvim'
  -- use 'Darazaki/indent-o-matic'
  use 'tpope/vim-repeat'
  use 'davidgranstrom/nvim-markdown-preview'
  use 'rcarriga/nvim-notify'
  use 'b3nj5m1n/kommentary'
  use 'mfussenegger/nvim-dap'
  use 'kassio/neoterm'
  use 'folke/lsp-colors.nvim'
  use 'windwp/windline.nvim'
  use 'glepnir/lspsaga.nvim'
  use "lukas-reineke/indent-blankline.nvim"
  use 'voldikss/vim-translator'

  --[[ use {
  'nvim-lualine/lualine.nvim',
  requires = { 'kyazdani42/nvim-web-devicons', opt = true }
} ]]

  use {
  'akinsho/bufferline.nvim',
  requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}

  use {
  'nvim-tree/nvim-tree.lua',
  requires = {
  'nvim-tree/nvim-web-devicons'
  },
  tag = 'nightly' -- optional, updated every week. (see issue #1193)
}

  use {
  'nvim-treesitter/nvim-treesitter',
  run = ':TSUpdate',
}

  use { 'rcarriga/nvim-dap-ui', requires = {'mfussenegger/nvim-dap'} }

  use {
  'nvim-telescope/telescope.nvim', tag = '0.1.1',
-- or                            , branch = '0.1.x',
  requires = { {'nvim-lua/plenary.nvim'} }
}

  use {
    'goolord/alpha-nvim',
    config = function ()
        require'alpha'.setup(require'alpha.themes.dashboard'.config)
    end
}

use {
"folke/todo-comments.nvim",
requires = "nvim-lua/plenary.nvim",
config = function()
  require("todo-comments").setup {
  keywords = {
  FIX = {
    icon = " ", -- icon used for the sign, and in search results
    color = "#DC2626", -- can be a hex color, or a named color (see below)
    alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
    -- signs = false, -- configure signs for some keywords individually
  },
  TODO = { icon = " ", color = "#2563EB" },
  HACK = { icon = " ", color = "#FFFF2E" },
  WARN = { icon = " ", color = "#FBBF24", alt = { "WARNING", "XXX" } },
  PERF = { icon = " ", color = "#FC9868", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
  NOTE = { icon = " ", color = "#10B981", alt = { "INFO" } },
  TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
},
  }
end
}

  use {
	'windwp/nvim-autopairs',
    config = function() require('nvim-autopairs').setup {} end
}

  use {
  'lewis6991/gitsigns.nvim',
  config = function()
    require('gitsigns').setup()
  end
}

  use {
    'folke/tokyonight.nvim',
  }

  use {
    'numToStr/Comment.nvim',
    config = function()
        require('Comment').setup()
    end
}

  use {
  'phaazon/hop.nvim',
  branch = 'v2', -- optional but strongly recommended
  config = function()
    -- you can configure Hop the way you like here; see :h hop-config
    require'hop'.setup {
      keys = 'etovxqpdygfblzhckisuran',
      quit_key = '<C-c>',
    }
  end
}

  use {
    'kosayoda/nvim-lightbulb',
    requires = 'antoinemadec/FixCursorHold.nvim',
}

  use 'L3MON4D3/LuaSnip'

  use {
    -- logo
    'onsails/lspkind.nvim',

    -- mason language server
    'williamboman/mason.nvim',
    'williamboman/mason-lspconfig.nvim',
    'neovim/nvim-lspconfig',

    -- cmp
    'hrsh7th/cmp-nvim-lsp',
    'hrsh7th/cmp-buffer',
    'hrsh7th/cmp-path',
    'hrsh7th/cmp-cmdline',
    -- 'hrsh7th/cmp-vsnip',
    'hrsh7th/vim-vsnip',
    'saadparwaiz1/cmp_luasnip',
    'rafamadriz/friendly-snippets',
    'hrsh7th/nvim-cmp',
    'hrsh7th/cmp-nvim-lsp-signature-help',
    'ray-x/cmp-treesitter',
    -- "ray-x/lsp_signature.nvim",
}

if packer_bootstrap then
    require('packer').sync()
end
end)
